---
layout: "default"
title: "EncodingError"
description: "Swift documentation for 'EncodingError': An error that occurs during the encoding of a value."
keywords: "EncodingError,enum,swift,documentation"
root: "/v4.2"
---

<div class="intro-declaration"><code class="language-swift">enum EncodingError</code></div>

<div class="discussion comment">
    <p>An error that occurs during the encoding of a value.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">Error</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>


<tr>
<th>Nested Types</th>
<td><code class="nested">EncodingError.Context</code></td>
</tr>

<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>

<h3 id="cases">Cases</h3>
<div class="declaration" id="case-invalidValue">
<a class="toggle-link" data-toggle="collapse" href="#comment-case-invalidValue">case invalidValue(Any, EncodingError.Context)</a>
<div class="comment collapse" id="comment-case-invalidValue"><div class="p">
    <p>An indication that an encoder or its containers could not encode the
given value.</p>

<p>As associated values, this case contains the attempted value and context
for debugging.</p>

    <h4>Declaration</h4>    
    <code class="language-swift"></code>
</div></div>
</div>








<h3>Conditionally Inherited Items</h3>

<p class="comment">The initializers, methods, and properties listed below may be available on this type under certain conditions (such as methods that are available on <code>Array</code> when its elements are <code>Equatable</code>) or may not ever be available if that determination is beyond SwiftDoc.org's capabilities. Please <a href="https://github.com/SwiftDocOrg/swiftdoc.org/issues">open an issue on GitHub</a> if you see something out of place!</p>





<h4>Where RawValue : SignedInteger</h4>









<h4>Where RawValue : UnsignedInteger</h4>







